package org.mcflier.appuntamento.data.model;

import java.sql.Timestamp;
import java.util.ArrayList;
import java.util.List;

import org.mcflier.appuntamento.data.model.abstracts.AbstractIMDBList;

public class IMDBList extends AbstractIMDBList {
	
	private String title;
	private String link;
	private String description;
	private Timestamp pubDate;
	private Timestamp lastBuildDate;
	private List<IMDBListItem> items;

	public IMDBList(String title, String link, String description, Timestamp pubDate, Timestamp lastBuildDate) {
		this.title = title;
		this.link = link;
		this.description = description;
		this.pubDate = pubDate;
		this.lastBuildDate = lastBuildDate;
		this.items = new ArrayList<IMDBList.IMDBListItem>();
	}
	
	public IMDBList(String title, String link){
		this.title = title;
		this.link = link;
		this.description = null;
		this.pubDate = null;
		this.lastBuildDate = null;
		this.items = new ArrayList<IMDBList.IMDBListItem>();
	}
	
	/* (non-Javadoc)
	 * @see org.mcflier.appuntamento.data.model.IIMDBList#getTitle()
	 */
	@Override
	public String getTitle() {
		return title;
	}

	/* (non-Javadoc)
	 * @see org.mcflier.appuntamento.data.model.IIMDBList#setTitle(java.lang.String)
	 */
	@Override
	public void setTitle(String title) {
		this.title = title;
	}

	/* (non-Javadoc)
	 * @see org.mcflier.appuntamento.data.model.IIMDBList#getLink()
	 */
	@Override
	public String getLink() {
		return link;
	}

	/* (non-Javadoc)
	 * @see org.mcflier.appuntamento.data.model.IIMDBList#setLink(java.lang.String)
	 */
	@Override
	public void setLink(String link) {
		this.link = link;
	}

	/* (non-Javadoc)
	 * @see org.mcflier.appuntamento.data.model.IIMDBList#getDescription()
	 */
	@Override
	public String getDescription() {
		return description;
	}

	/* (non-Javadoc)
	 * @see org.mcflier.appuntamento.data.model.IIMDBList#setDescription(java.lang.String)
	 */
	@Override
	public void setDescription(String description) {
		this.description = description;
	}

	/* (non-Javadoc)
	 * @see org.mcflier.appuntamento.data.model.IIMDBList#getPubDate()
	 */
	@Override
	public Timestamp getPubDate() {
		return pubDate;
	}

	/* (non-Javadoc)
	 * @see org.mcflier.appuntamento.data.model.IIMDBList#setPubDate(java.sql.Timestamp)
	 */
	@Override
	public void setPubDate(Timestamp pubDate) {
		this.pubDate = pubDate;
	}

	/* (non-Javadoc)
	 * @see org.mcflier.appuntamento.data.model.IIMDBList#getLastBuildDate()
	 */
	@Override
	public Timestamp getLastBuildDate() {
		return lastBuildDate;
	}

	/* (non-Javadoc)
	 * @see org.mcflier.appuntamento.data.model.IIMDBList#setLastBuildDate(java.sql.Timestamp)
	 */
	@Override
	public void setLastBuildDate(Timestamp lastBuildDate) {
		this.lastBuildDate = lastBuildDate;
	}

	/* (non-Javadoc)
	 * @see org.mcflier.appuntamento.data.model.IIMDBList#addItem(org.mcflier.appuntamento.data.model.IMDBList.IMDBListItem)
	 */
	@Override
	public void addItem(IMDBListItem item) {
		this.items.add(item);
	}

	/* (non-Javadoc)
	 * @see org.mcflier.appuntamento.data.model.IIMDBList#getItems()
	 */
	@Override
	public List<IMDBListItem> getItems() {
		return this.items;
	}

	public class IMDBListItem{
		private String title, link, guid, description;
		private Timestamp pubDate, lastBuildDate;

		public IMDBListItem(String title, String link, String guid, String description, Timestamp pubDate, Timestamp lastBuildDate) {
			this.title = title;
			this.link = link;
			this.guid = guid;
			this.description = description;
			this.pubDate = pubDate;
			this.lastBuildDate = lastBuildDate;
		}

		public IMDBListItem(String title, String link) {
			super();
			this.title = title;
			this.link = link;
			this.guid = null;
			this.description = null;
			this.pubDate = null;
			this.lastBuildDate = null;
		}

		public String getTitle() {
			return title;
		}

		public void setTitle(String title) {
			this.title = title;
		}

		public String getLink() {
			return link;
		}

		public void setLink(String link) {
			this.link = link;
		}

		public String getGuid() {
			return guid;
		}

		public void setGuid(String guid) {
			this.guid = guid;
		}

		public String getDescription() {
			return description;
		}

		public void setDescription(String description) {
			this.description = description;
		}

		public Timestamp getPubDate() {
			return pubDate;
		}

		public void setPubDate(Timestamp pubDate) {
			this.pubDate = pubDate;
		}

		public Timestamp getLastBuildDate() {
			return lastBuildDate;
		}

		public void setLastBuildDate(Timestamp lastBuildDate) {
			this.lastBuildDate = lastBuildDate;
		}
		
		public String toString(){
			return this.link+" "+this.title;
		}
	}
}
